<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>字符串下标</title>
	</head>
	<body>
	</body>
	<script type="text/javascript">
		var str1 = '123454321';
		var str2 = '1';
		document.write(str1.indexOf(str2));
		document.write("<br/>");
		document.write(str1.lastIndexOf(str2));
	</script>
</html>
